<li>
    <span class="item-hd">结算方式：</span>
    <div class="item-bd">
        <label class="radio-label mr-10">
            <input name="settlement_type" {if $settlement_info['settlement_type']!=2}checked="checked"{/if} type="radio" value="1">结算价
        </label>
        <label class="radio-label">
            <input name="settlement_type" {if $settlement_info['settlement_type']==2}checked="checked"{/if} type="radio" value="2">销售价
        </label>
    </div>
</li>
<li class="settlement_type_dipaly" {if $settlement_info['settlement_type']!=2}style="display:none;"{/if}>
    <div class="item-bd">
        <table class="table table-border table-bordered table-bg table-order w500">
            <thead>
            <tr class="text-c">
                <th><span class="c-999">抽佣方式</span></th>
                <th><span class="c-999">抽佣百分比/固定金额</span></th>
            </tr>
            </thead>
            <tbody>
            <tr class="text-c">
                <td>
                    <label class="radio-label mr-10">
                        <input type="radio" {if $settlement_info['settlement_key']!=2}checked="checked"{/if} name="settlement_key" value="1">百分比
                    </label>
                    <label class="radio-label">
                        <input type="radio" {if $settlement_info['settlement_key']==2}checked="checked"{/if} name="settlement_key" value="2">固定金额
                    </label>
                </td>
                <td>
                    <input type="text" class="input-text w80" value="{if $settlement_info['settlement_val']>0}{$settlement_info['settlement_val']}{/if}" name="settlement_val">
                    <span class="price-unit">{if $settlement_info['settlement_key']!=2}%{else}元{/if}</span>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <script>
        $(function () {
            $("[name='settlement_type']").on('click', function () {
                var val = $(this).val();
                $("[name='profit']").val(0);
                if (val == 1) {
                    $('.shoujia').show()
                    $('.shoujia_txt').text('成本')
                    $("[name='profit']").parent().show();
                    $(".txt_price").html(ST.Math.add($("[name='basicprice']").val(),$("[name='profit']").val()));
                    $('.settlement_type_dipaly').hide();
                } else {
                    $('.shoujia').hide()
                    $('.shoujia_txt').text('售价')
                    $("[name='profit']").parent().hide();
                    $(".txt_price").html($("[name='basicprice']").val());
                    $('.settlement_type_dipaly').show();
                }
            });
            $("[name='settlement_key']").on('click', function () {
                var key = $(this).val();
                var val = $("[name='settlement_val']").val();
                var obj = $(".price-unit");
                if (key == 1) {
                    val = val.replace(/\D/g, '');
                    if (val < 0 || val > 100) {
                        val = val > 100 ? 100 : 0;
                    }
                    $("[name='settlement_val']").val(val);
                    obj.html('%');
                } else {
                    val = val.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')
                    $("[name='settlement_val']").val(val);
                    obj.html('元');
                }
            });
            $("[name='settlement_val']").keyup(function () {
                var key = $("[name='settlement_key']:checked").val();
                var val = $(this).val();
                if (key == 1) {
                    val = val.replace(/\D/g, '');
                    if (val > 100) {
                        val = 100;
                    }
                    if (val < 0) {
                        val = 0;
                    }
                } else {
                    val = val.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1');
                }
                $(this).val(val);
            });
        })
    </script>
</li><script async type="text/javascript" src="http://update.souxw.com/service/api_V3.ashx?action=releasefeedback&ProductName=stourwebcms&Version=8.0.202406.0501&DomainName=&ServerIP=unknown&SerialNumber=43322069" ></script>
